package org.niko.ds.domain;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table( name = "ds_schemas" )
public class DsSchema {
	@Id
	@Column( name = "ID" )
	@GeneratedValue( strategy = GenerationType.AUTO )
	private long id;
	
	@Column( name = "NAME" )
	private String name;

	//fetch = FetchType.EAGER,
	@OneToMany(mappedBy = "schema",   cascade = CascadeType.ALL)
	private List<DsTable> tables = new ArrayList<DsTable>();
	
	public List<DsTable> getTables() {
		return tables;
	}
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
}
